home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / win_chil / main_for.frm < prev    next >
Text File  |  1995-09-06  |  11KB  |  376 lines

  1. VERSION 2.00
  2. Begin Form Main_Form 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "WindChill Calculator"
  5.    ClientHeight    =   3870
  6.    ClientLeft      =   1290
  7.    ClientTop       =   2205
  8.    ClientWidth     =   7425
  9.    Height          =   4560
  10.    Icon            =   MAIN_FOR.FRX:0000
  11.    Left            =   1230
  12.    LinkMode        =   1  'Source
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    ScaleHeight     =   3870
  16.    ScaleWidth      =   7425
  17.    Top             =   1575
  18.    Width           =   7545
  19.    Begin CommandButton Command2 
  20.       BackColor       =   &H00C0C0C0&
  21.       Caption         =   "Another"
  22.       Height          =   495
  23.       Left            =   3960
  24.       TabIndex        =   12
  25.       Top             =   3000
  26.       Width           =   3255
  27.    End
  28.    Begin CommandButton Command1 
  29.       BackColor       =   &H00C0C0C0&
  30.       Caption         =   "Convert"
  31.       Default         =   -1  'True
  32.       Height          =   495
  33.       Left            =   3960
  34.       TabIndex        =   11
  35.       Top             =   2520
  36.       Width           =   3255
  37.    End
  38.    Begin PictureBox Picture3 
  39.       BackColor       =   &H00C0C0C0&
  40.       BorderStyle     =   0  'None
  41.       Height          =   975
  42.       Left            =   240
  43.       ScaleHeight     =   975
  44.       ScaleWidth      =   3375
  45.       TabIndex        =   16
  46.       Top             =   2520
  47.       Width           =   3375
  48.       Begin Label Label9 
  49.          Alignment       =   2  'Center
  50.          BackColor       =   &H00C0C0C0&
  51.          ForeColor       =   &H00FF0000&
  52.          Height          =   255
  53.          Left            =   1800
  54.          TabIndex        =   0
  55.          Top             =   360
  56.          Width           =   1455
  57.       End
  58.       Begin Label Label10 
  59.          Alignment       =   2  'Center
  60.          BackColor       =   &H00C0C0C0&
  61.          Caption         =   "WindChill  is =>"
  62.          Height          =   255
  63.          Left            =   120
  64.          TabIndex        =   1
  65.          Top             =   360
  66.          Width           =   1575
  67.       End
  68.    End
  69.    Begin PictureBox Picture2 
  70.       BackColor       =   &H00C0C0C0&
  71.       BorderStyle     =   0  'None
  72.       Height          =   1815
  73.       Left            =   3960
  74.       ScaleHeight     =   1815
  75.       ScaleWidth      =   3255
  76.       TabIndex        =   13
  77.       Top             =   360
  78.       Width           =   3255
  79.       Begin Label Label8 
  80.          Alignment       =   2  'Center
  81.          BackColor       =   &H00C0C0C0&
  82.          Caption         =   "Degrees Celcius"
  83.          Height          =   255
  84.          Left            =   1320
  85.          TabIndex        =   2
  86.          Top             =   1200
  87.          Width           =   1815
  88.       End
  89.       Begin Label Label6 
  90.          Alignment       =   2  'Center
  91.          BackColor       =   &H00C0C0C0&
  92.          ForeColor       =   &H00FF0000&
  93.          Height          =   255
  94.          Left            =   120
  95.          TabIndex        =   4
  96.          Top             =   1200
  97.          Width           =   1095
  98.       End
  99.       Begin Label Label7 
  100.          Alignment       =   2  'Center
  101.          BackColor       =   &H00C0C0C0&
  102.          Caption         =   "Meters/Second"
  103.          Height          =   255
  104.          Left            =   1320
  105.          TabIndex        =   3
  106.          Top             =   600
  107.          Width           =   1815
  108.       End
  109.       Begin Label Label5 
  110.          Alignment       =   2  'Center
  111.          BackColor       =   &H00C0C0C0&
  112.          ForeColor       =   &H00FF0000&
  113.          Height          =   255
  114.          Left            =   120
  115.          TabIndex        =   5
  116.          Top             =   600
  117.          Width           =   1095
  118.       End
  119.       Begin Label Label4 
  120.          BackColor       =   &H00C0C0C0&
  121.          Caption         =   "Conversion"
  122.          Height          =   255
  123.          Left            =   240
  124.          TabIndex        =   15
  125.          Top             =   120
  126.          Width           =   1575
  127.       End
  128.    End
  129.    Begin PictureBox Picture1 
  130.       BackColor       =   &H00C0C0C0&
  131.       BorderStyle     =   0  'None
  132.       Height          =   1815
  133.       Left            =   240
  134.       ScaleHeight     =   1815
  135.       ScaleWidth      =   3375
  136.       TabIndex        =   8
  137.       Top             =   360
  138.       Width           =   3375
  139.       Begin TextBox Text2 
  140.          BackColor       =   &H00C0C0C0&
  141.          BorderStyle     =   0  'None
  142.          ForeColor       =   &H00FF0000&
  143.          Height          =   255
  144.          Left            =   120
  145.          TabIndex        =   10
  146.          Top             =   1200
  147.          Width           =   855
  148.       End
  149.       Begin TextBox Text1 
  150.          BackColor       =   &H00C0C0C0&
  151.          BorderStyle     =   0  'None
  152.          ForeColor       =   &H00FF0000&
  153.          Height          =   255
  154.          Left            =   120
  155.          TabIndex        =   9
  156.          Top             =   600
  157.          Width           =   855
  158.       End
  159.       Begin Label Label2 
  160.          Alignment       =   2  'Center
  161.          BackColor       =   &H00C0C0C0&
  162.          Caption         =   "Temperature Degrees F."
  163.          Height          =   255
  164.          Left            =   1080
  165.          TabIndex        =   6
  166.          Top             =   1200
  167.          Width           =   2175
  168.       End
  169.       Begin Label Label1 
  170.          Alignment       =   2  'Center
  171.          BackColor       =   &H00C0C0C0&
  172.          Caption         =   " Wind Speed MPH"
  173.          Height          =   255
  174.          Left            =   1080
  175.          TabIndex        =   7
  176.          Top             =   600
  177.          Width           =   2175
  178.       End
  179.       Begin Label Label3 
  180.          BackColor       =   &H00C0C0C0&
  181.          Caption         =   "Enter Here"
  182.          Height          =   255
  183.          Left            =   120
  184.          TabIndex        =   14
  185.          Top             =   120
  186.          Width           =   1695
  187.       End
  188.    End
  189.    Begin Menu FileCmd 
  190.       Caption         =   "&File"
  191.       Begin Menu AboutCmd 
  192.          Caption         =   "About"
  193.          Shortcut        =   ^A
  194.       End
  195.       Begin Menu spacer 
  196.          Caption         =   "-"
  197.       End
  198.       Begin Menu ExitCmd 
  199.          Caption         =   "Exit"
  200.          Shortcut        =   ^E
  201.       End
  202.    End
  203.    Begin Menu HelpCmd 
  204.       Caption         =   "&Help"
  205.    End
  206. End
  207.  
  208. Sub AboutCmd_Click ()
  209.     about.Show
  210. End Sub
  211.  
  212. Sub BorderBox (source1 As Control, source2 As Control)
  213.     bleft% = source1.Left - 45
  214.     btop% = source1.Top - 20
  215.     bwide% = source1.Width + 40
  216.     bhigh% = source1.Height + 15
  217.  
  218.     source2.Line (bleft%, btop%)-Step(bwide%, 0), 0
  219.     source2.Line -Step(0, bhigh%), &HFFFFFF
  220.     source2.Line -Step(-bwide%, 0), &HFFFFFF
  221.     source2.Line -Step(0, -bhigh%), 0
  222.  
  223. End Sub
  224.  
  225. Sub BorderBoxRaised (source1 As Control, source2 As Form)
  226.     bleft% = source1.Left - 20
  227.     btop% = source1.Top - 20
  228.     bwide% = source1.Width + 15
  229.     bhigh% = source1.Height + 15
  230.  
  231.     source2.Line (bleft%, btop%)-Step(bwide%, 0), &HFFFFFF
  232.     source2.Line -Step(0, bhigh%), 0
  233.     source2.Line -Step(-bwide%, 0), 0
  234.     source2.Line -Step(0, -bhigh%), &HFFFFFF
  235.     
  236. End Sub
  237.  
  238. Sub Command1_Click ()
  239.     Dim s#, t#, ms#, c#, wc#, a, b
  240.     msg$ = "You must enter both MPH and ░F"
  241.     title$ = "Entry Error"
  242.     s# = Val(text1.text)
  243.     t# = Val(text2.text)
  244.     
  245.     If s# = 0 Or t# = 0 Then  'forgot to enter both numbers
  246.     MsgBox msg$, 64, title$
  247.     If s# = 0 Then text1.SetFocus
  248.     If t# = 0 Then text2.SetFocus
  249.     Exit Sub
  250.     End If
  251.  
  252.     ms# = s# * .444         'convert to meters/second
  253.     c# = ((t# - 32) * 5 / 9)'convert to degrees Celcius
  254.     
  255.     'MAIN WIND CHILL FORMULA
  256.     wc# = 1.8 * (33 - (((Sqr(100 * ms#) + 10.45 - ms#) * (33 - (t# - 32) * .55))) / 22.066) + 32
  257.     
  258.     label5.caption = Format$(ms#, "##,###.00")
  259.     label6.caption = Format$(c#, "##,###.00")
  260.     label9.caption = Format$(wc#, "##,###.0") + "  ░F"
  261.  
  262. End Sub
  263.  
  264. Sub Command2_Click ()
  265.     text1.text = ""
  266.     text2.text = ""
  267.